package br.com.fidalgotecnologia.layar.json;




import org.json.JSONException;
import org.json.JSONObject;

import br.com.fidalgotecnologia.core.constantes.Links;
import br.com.fidalgotecnologia.layar.entity.HotSpot;

public class HotSpotJson {
    private HotSpot hotSpot;
    private JSONObject json;
    
    public HotSpotJson(HotSpot hotSpot){
    	this.hotSpot = hotSpot;
    	json = new JSONObject();
    	try {
			json.put( "id",this.hotSpot.getId());
			json.put( "anchor",new AnchorJson(this.hotSpot.getAnchor()).getJson());
			json.put( "imageURL",Links.LINK_IMAGEM_HOTSPOT+hotSpot.getId());
			json.put( "text",new TextJson(this.hotSpot.getText()).getJson());
			json.put( "object ",new ObjectJson(this.hotSpot.getObject()).getJson());
			json.put( "transform  ",new TransformJson(this.hotSpot.getTransform()).getJson());
			json.put( "doNotIndex",hotSpot.isDoNotIndex());
			json.put( "inFocus", hotSpot.isInFocus());
			json.put( "showSmallBiw", hotSpot.isShowSmallBiw());
			json.put( "showBiwOnClick", hotSpot.isShowBiwOnClick());
			json.put( "icon  ",new IconJson(this.hotSpot.getIcon()).getJson());
			json.put( "biwStyle", hotSpot.getBiwStyle());
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    
   public JSONObject getJson() {
	return json;
}
    
	@Override
	public String toString() {
		String retorno = null;
		
		try {
			
			retorno = json.toString();
		} catch (Exception  e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return retorno;
	}
}
